package com.chuangjiangx.member.basic.ddd.query;

import com.chuangjiangx.member.basic.dao.mapper.InMbrConfigMapper;
import com.chuangjiangx.member.basic.dao.model.InMbrConfig;
import com.chuangjiangx.member.basic.dao.model.InMbrConfigExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author cj-ch
 * @date 2018/6/29 下午3:47
 */
@Component
public class MbrConfigQuery {

    @Autowired
    private InMbrConfigMapper inMbrConfigMapper;


    public InMbrConfig queryByMerchantId(Long merchantId){
        InMbrConfigExample example = new InMbrConfigExample();
        example.createCriteria()
                .andMerchantIdEqualTo(merchantId);

        List<InMbrConfig> inMbrConfigs = inMbrConfigMapper.selectByExample(example);
        return inMbrConfigs.isEmpty() ? null : inMbrConfigs.get(0);
    }
}
